package com.zjy.utils;

import java.util.UUID;

public class UUIDUtils {

    public static String getUUID(){
        return UUID.randomUUID().toString().replace("-","");
    }

    public static String getOrderNoByUUId() {
        int machineId = 1;//最大支持1-9个集群机器部署
        int hashCodeV = UUID.randomUUID().toString().hashCode();
        if(hashCodeV < 0) {//有可能是负数
            hashCodeV = - hashCodeV;
        }
        return machineId+ String.format("%015d", hashCodeV);
    }


    public static void main(String[] arg){

        System.out.println(getUUID());
        System.out.println(getUUID());
        System.out.println(getUUID());

    }
}
